-- ~/.config/nvim/lua/plugins/lspsaga.lua
return {
  "nvimdev/lspsaga.nvim",
  event = "LspAttach",
  dependencies = {
    "nvim-treesitter/nvim-treesitter",
    "nvim-tree/nvim-web-devicons",
  },
  opts = {
    ui = {
      border = "rounded",
      code_action = "💡",
    },
    hover = {
      max_width = 0.6,
      max_height = 0.8,
    },
    diagnostic = {
      border_follow = true,
      show_code_action = true,
    },
    lightbulb = {
      enable = true,
      sign = false,  -- 不在行号旁显示灯泡
      virtual_text = true,  -- 在行尾显示灯泡
    },
    symbol_in_winbar = {
      enable = false,  -- ❌ 关闭面包屑导航
    },
  },
  keys = {
    { "K", "<cmd>Lspsaga hover_doc<cr>", desc = "Hover Doc" },
    { "gh", "<cmd>Lspsaga finder<cr>", desc = "LSP Finder" },
    { "gp", "<cmd>Lspsaga peek_definition<cr>", desc = "Peek Definition" },
    { "gd", "<cmd>Lspsaga goto_definition<cr>", desc = "Goto Definition" },
    { "<leader>ca", "<cmd>Lspsaga code_action<cr>", desc = "Code Action", mode = { "n", "v" } },
    { "<leader>cr", "<cmd>Lspsaga rename<cr>", desc = "Rename" },
    { "[d", "<cmd>Lspsaga diagnostic_jump_prev<cr>", desc = "Prev Diagnostic" },
    { "]d", "<cmd>Lspsaga diagnostic_jump_next<cr>", desc = "Next Diagnostic" },
    { "<leader>o", "<cmd>Lspsaga outline<cr>", desc = "Outline" },
    { "<leader>ci", "<cmd>Lspsaga incoming_calls<cr>", desc = "Incoming Calls" },
    { "<leader>co", "<cmd>Lspsaga outgoing_calls<cr>", desc = "Outgoing Calls" },
  },
}
